<?php
require_once __DIR__ . '/../vendor/autoload.php';
use PhpAmqpLib\Connection\AMQPStreamConnection;
use PhpAmqpLib\Message\AMQPMessage;
class send
{
    public function __construct()
    {
        echo 'qqqq';
        // var_dump(__DIR__ . '../../vendor/autoload.php');exit;
        $this->send();
    }

    public function send()
    {
        $connection = new AMQPStreamConnection('localhost', 5672, 'chenmiao', '123456');
        $channel = $connection->channel();
        $channel->queue_declare('hello', false, false, false, false);
        $message = new AMQPMessage('Hello World!');

        $channel->basic_publish($message, '', 'hello');

        echo " [x] Sent 'Hello World!'\n";

        $channel->close();
        $connection->close();
    }
}

new send();